# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=strace
pkgver=6.8
pkgrel=0
pkgdesc="Diagnostic, debugging and instructional userspace tracer"
url="https://strace.io"
arch="all"
# disable checks for now, due to testsuite failure
options="!check"
license="BSD-3-Clause"
# strace with libunwind doesn't work right on musl
makedepends="binutils-dev elfutils-dev gawk linux-headers"
subpackages="$pkgname-doc"
source="https://github.com/strace/strace/releases/download/v$pkgver/strace-$pkgver.tar.xz
	disable-fortify.patch
	nlattr-fix.patch
	"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-mpers=no
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
c477724a77112a74a5236a38b7dbaa9b6199622a1d21cc6253cac80dc4ddea78aeaf8cddf4a51ee4119e00e1adaf95f64f64e20d9775ec3edd77cd82c8f7b30e  strace-6.8.tar.xz
273b92ebf0069f19bef7ec26c7860e2af7ef01e782255c70ded1ae5e967f8f6bf031ecba96612c6083bf58f46278ba4ab3ec0fb35b08c8c8d668191f97adee52  disable-fortify.patch
44b1872cf996caa4970fa6c2875a3a2cffe4a38455e328d968bd7855ef9a05cf41190794dc137bc8667576635f5271057cf0e6cde9a6c7aee66afd1dba9bdba0  nlattr-fix.patch
"
